package com.example.bbook.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.bbook.util.HashMapTool;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.HashMap;

@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Data
@TableName("g_eva")
public class EvaEntity extends BaseEntity {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Integer userId;
    private Integer goodsId;
    private String eventTime;
    private String remark;
    private Integer source;

    @TableField(exist = false)
    private UserEntity userEntity;

    public EvaEntity() {
        setColumns(new ArrayList<>());
        push("id", "number", "ID", new int[]{0, 1, 1, 0})
                .push("userId", "number", "用户ID", new int[]{1, 1, 1, 0})
                .push("goodsId", "number", "商品ID", new int[]{1, 1, 1, 0})
                .push("eventTime", "time", "评价时间", new int[]{1, 1, 1, 1})
                .push("remark", "string", "评价内容", new int[]{1, 1, 1, 1})
                .push("source", "number", "评价分值", new int[]{1, 1, 1, 1});

    }

    public ArrayList<HashMap<String, Object>> thisColumns() {
        return getColumns();
    }
}
